import * as constants from './constants'

const defaultState = {
  topic: {
    data: {
      author: {
        loginname: 'xbb'
      },
      tab: 'ask',
      title: 'CN ACC',
      create_at: '2020/12/5',
      visit_count: 20
    }
  },
}

export default (state = defaultState, action) => {
  switch (action.type) {
    case constants.CHANGE_TOPIC_DATA:
      return Object.assign({}, state, {
        topic: action.data,
      })
    default:
      return state;
  }
}